package masterMind;


import ewe.fx.Color;
import ewe.fx.Image;
import ewe.fx.mImage;
import ewe.graphics.AniImage;
import ewe.graphics.InteractivePanel;
import ewe.ui.Canvas;

public class Tablero extends InteractivePanel{
	//               40
	//               26
	final int incy = 40;
	//               35
	//               28
	final int incx = 35;
	private int  alto;
	
	public void addBalls(char[] c, int l, int n) {
		Image cols ;		
		for(int i=0; i<n; i++) {
			cols =new Image("imgs/"+c[i]+"_.png");
			cols.transparent = Color.White;
			AniImage ai = new AniImage(cols);		
			ai.location.x = 10+(incx*i);
			ai.location.y = alto-incy*l;
			addImage(ai);			
		}
		refresh();
		
	}
	
	public void addMiniBalls(int[] bw, int l) {
		Image cols ;		
		for(int i=0; i<bw[0]+bw[1]; i++) {		
			cols =i<bw[0]?new Image("imgs/blanca.png"):new Image("imgs/negra.png");
			cols.transparent = Color.White;
			AniImage ai = new AniImage(cols);
			//                      180        20     180        20
			//                      150        15     150        15
			/*

			*/
			
			ai.location.x = i<3?180+((incx-20)*i):180+((incx-20)*(i-3));
			ai.location.y = i<3?alto+2-incy*l:alto+15-incy*l;
			addImage(ai);			
		}
		refresh();		
	}	
	
	void addHoles(int n, int l) {
		AniImage hole;
		for(int i=0; i<n; i++) {
			hole = new AniImage(new mImage("imgs/vacia.png",Color.White));
			hole.move(10+(incx*i),alto-incy*l);
			addImage(hole);
		}
		refresh();
	}

	public Tablero( int alto, int n)
	{
		
		this.alto = alto-30;
		backGround= ewe.fx.Color.White;
		borderWidth = 2; borderStyle = Canvas.EDGE_SUNKEN;	
		for(int i=0;i<n; i++)
			addHoles(5,i);						
	}
}


